<?php
require_once('db/dba.php');
db_connect();

include "db/db_con.php";
$data=$_POST["data"];

  $insert= "INSERT INTO travel (coustomer,email,phone,trip_type,fromdata,todata,returndate,depart,infants,adults,children)  VALUES ('".$data["coustomer"]."','".$data["email"]."','".$data['phone']."','".$data['trip_type']."','".$data['from']."','".$data['to']."','".$data['returndate']."','".$data["depart"]."','".$data["infants"]."','".$data["adults"]."','".$data["children"]."')";
query($insert); 
echo  "<font color='green'>You request #". mysql_insert_id()." is sent to vendor</font>";


$subject="Request Id#".mysql_insert_id();

$message="
<p>Dear  ".$data['coustomer'].", </p>
<p>This is to your Flight booking request. Below are the details. </p>
<p>Request Number: ".mysql_insert_id()."</p>
<p>Status: Open</p>


<p>Flight Booking details:</p>
<p>Customer Name:  ".$data['coustomer']."</p>
<p>Email:  ".$data['email']."</p>
<p>Phone: ".$data['phone']."</p>";


if($data['trip_type']=="OneWay")
{
$message.="<p>Depart: One Way </p>";
}

else
$message.="<p>Depart: Round Trip </p>";

$message.="
<p>From: $data[from]</p>
<p>To: ".$data['to']."</p>
<p>Depart: ".$data['depart']."</p>
";

if($data['returndate']!="")
{
$message .="<p>Return Date:  ".$data['returndate']."</p>";
}


$message.="
<p>Adults:  ".$data['adults']."</p>
<p>Children:  ".$data['children']."</p>
<p>Infants:  ".$data['infants']."</p>

<p>Connect to us:</p>
<p>We would like to hear from you.</p>
<p>For any questions, suggestions or comments please contact us at:</p>
<p>Warm regards,</p>

<p>Manish TalwarShree Communications</p>
";

/*
$message="<p>Thank You For Information</p>";


$message .="<p>Customer Name:  ".$data['coustomer']."</p>";
$message .="<p>Email:  ".$data['email']."</p>";
$message .="<p>Phone:  ".$data['phone']."</p>";
$message .="<p>Trip Type:  ".$data['trip_type']."</p>";
$message .="<p>From:  ".$data['from']."</p>";
$message .="<p>To:  ".$data['to']."</p>";
$message .="<p>Depart:  ".$data['depart']."</p>";
if($data['returndate']!="")
{
$message .="<p>Return Date:  ".$data['returndate']."</p>";
}

$message .="<p>Infants:  ".$data['infants']."</p>";
$message .="<p>Adults:  ".$data['adults']."</p>";
$message .="<p>Children:  ".$data['children']."</p>";

*/
$headers= "Content-type: text/html\r\n"; 


mail($data["email"], $subject, $message, $headers);
//mail('mail@firstnorthglobal.com', $subject, $message, $headers);

mail('mail@firstnorthglobal.com', $subject, $message, $headers);



?>